#!/bin/bash
#

echo "创建新用户"

read -p "设置用户名:" name
id $name &> /dev/null

if [ $? -eq 0 ]; then 
 echo "用户${name}已存在"
else
 useradd $name

read -p "设置密码:" password

useradd $name
echo "$password" | passwd --stdin $name &> /dev/null

echo "用户:${name}创建完成,密码是$password"
fi
#ssh $name@127.0.0.1
